<!--
 *   Licensed to the Apache Software Foundation (ASF) under one
 *   or more contributor license agreements.  See the NOTICE file
 *   distributed with this work for additional information
 *   regarding copyright ownership.  The ASF licenses this file
 *   to you under the Apache License, Version 2.0 (the
 *   "License"); you may not use this file except in compliance
 *   with the License.  You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing,
 *   software distributed under the License is distributed on an
 *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *   KIND, either express or implied.  See the License for the
 *   specific language governing permissions and limitations
 *   under the License.
 *
-->
<html>
<head>
    <title>Apache Fortress Ten Minute Guide</title>
    <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"/>
</head>
<body>
<hr>
<fieldset>
    <legend><b>Navigation Links</b></legend>
    <ul>
        <li><a href="./apache-directory-server.html">Setup Apache Directory Server</a></li>
        <li><a href="./apache-directory-studio.html">Setup Apache Directory Studio</a></li>
        <li><a href="./apache-fortress-core.html">Build Apache Fortress Core</a></li>
        <li><a href="./apache-fortress-realm.html">Build Apache Fortress Realm</a></li>
        <li><a href="./apache-tomcat.html">Setup Apache Tomcat Web Server</a></li>
        <li><a href="./apache-fortress-web.html">Build Apache Fortress Web</a></li>
        <li><a href="./apache-fortress-rest.html">Build Apache Fortress Rest</a></li>
    </ul>
    <a href="./ten-minute-guide.html">Ten Minute Guide</a>
</fieldset>
<hr>
<p>

<h3>Build Apache Fortress Core</h3>
<img src="fortress100.gif" alt="Apache Fortress Core"/>
<br/><br/>
<h4>This section provides instructions to install Fortress Core, setup usage with ApacheDS, and run the junit tests</h4>
Steps to complete:
<ol>
    <li>Set java and maven home env variables.</li>

    <br/>

    <li>
        Change directory:
            <pre>
                <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
cd directory-fortress-core/
                </p>
            </pre>
    </li>

    <li>
        Copy build.properties.example in root folder of package, to build.properties.
              <pre>
                <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
cp build.properties.example build.properties
                </p>
              </pre>
    </li>

    <li>
        Edit the build.properties in root folder of package.
        These parameters will be used to generate config artifacts: <b>config/fortress.properties</b> and <b>ldap/setup/refreshLDAPData.xml</b>,
        needed later on.
        <br/>
        Change the settings to:

              <pre>
                <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
# This points fortress to LDAP host.
ldap.host=localhost
ldap.port=10389
ldap.server.type=apacheds
                </p>
              </pre>

    </li>

    <li>
        Build fortress core. This step will generate config artifacts using settings from build.properties.
                <pre>
                    <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
mvn install
                    </p>
                </pre>
    </li>

    <li>
        Verify the following config artifacts were created by build as they are required later:
                <pre>
                    <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
ls -l config/fortress.properties
ls -l ldap/setup/refreshLDAPData.xml
                    </p>
                </pre>
    </li>

    <li>
        Load the Apache Fortress schema.
        <br/><br/>
        <ol type="A">
            Choose one option:
            <br/><br/>
            <li>
                Load the fortress schema contained in <b>ldap/schema/apacheds-fortress.ldif</b> to ApacheDS instance using command line.
                <pre>
                    <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
ldapmodify -h localhost -p 10389 -D uid=admin,ou=system -w secret -a -f FORTRESS_HOME/ldap/schema/apacheds-fortress.ldif
                    </p>
                </pre>
            </li>

            OR
            <br/><br/>

            <li>
                Load the fortress schema contained in <b>ldap/schema/apacheds-fortress.ldif</b> to ApacheDS instance using
                Apache Directory Studio.

                <br/><br/>

                <ol type="i">
                    <li>
                        In Apache Directory Studio LDAP Browser perspective, select Root DSE, right-click, and choose
                        Import->LDIF Import
                    </li>
                    <br/><img src="./schema-import-screenshot1.png" height="50%" width="50%" alt="Schema Import"/><br/><br/>

                    <br/>

                    <li>
                        Next a dialog box will appear where you can enter the fully qualified file name of the fortress schema.
                    </li>
                    <br/><img src="./schema-import-screenshot2.png" height="50%" width="50%" alt="Schema Import 2"/><br/><br/>

                    <br/>

                    <li>
                        The schema file is located under the fortress core base package/ldap/schema/apacheds-fortress.ldif
                    </li>
                    <br/><img src="./schema-import-screenshot3.png" height="50%" width="50%" alt="Schema Import 3"/><br/><br/>

                    <br/>

                    <li>
                        Verify success by viewing the cn=fortress schema node.
                    </li>
                    <br/><img src="./schema-import-screenshot4.png" height="50%" width="50%" alt="Schema Import 4"/><br/><br/>

                </ol>
            </li>

        </ol>

    </li>

    <li>
        Setup partition in ApacheDS server matching ldap server params in <b>config/fortress.properties</b> file.
    </li>

    <br/>

    <li>
        Build the fortress LDAP DIT, create its config node and load the A/RBAC policies:
                <pre>
                    <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
mvn install -Dload.file=./ldap/setup/refreshLDAPData.xml
mvn install -Dload.file=./ldap/setup/DelegatedAdminManagerLoad.xml
                    </p>
                </pre>
    </li>

    <li>
        Run the Fortress Core Regression Tess:
                <pre>
                    <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
mvn test -Dtest=FortressJUnitTest
                    </p>
                </pre>
        Tests should run with no errors.
    </li>

    <br/>

    <li>
        Run the Fortress Command Line Interface:
                <pre>
                    <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
mvn test -Pcli
                    </p>
                </pre>
        This program provides a command line interface for driving the fortress APIs. It is useful for ad-hoc and
        automated updates to the data. It's instruction manual is here:
        <a href="../cli/package-summary.html">Fortress CLI Instruction Manual</a>
    </li>

    <br/>

    <li>
        Run the Fortress Console:
                <pre>
                    <p style="font: monospace; color: black; background-color: lightgrey; font-size: 10pt">
mvn test -Pconsole
                    </p>
                </pre>
        This program provides an interfactive console for driving the fortress functions. It is useful for testing and
        ad-hoc updates to the data.
        <br/><br/>
        <ul>
            <li>Start at the Main Menu:
                <br/><img src="./screenshot-fortress-console-main.png" height="50%" width="40%"
                          alt="Fortress Console Main"/>
                <br/>Enter option to perform a particular manager function.
            </li>
            <br/>
            <li>Option '1' for RBAC Admin Manager Functions:
                <br/><img src="./screenshot-fortress-console-rbac-admin.png" height="50%" width="25%"
                          alt="Fortress Console Admin"/>
                <br/>Add, Update and Delete RBAC entities.
            </li>
            <br/>
            <li>Option '2' for RBAC Review Manager Functions:
                <br/><img src="./screenshot-fortress-console-rbac-review.png" height="50%" width="35%"
                          alt="Fortress Console Review"/>
                <br/>Read and Search RBAC entities.
            </li>
            <br/>
            <li>Option '3' for RBAC Access Manager Functions:
                <br/><img src="./screenshot-fortress-console-rbac-access.png" height="50%" width="35%"
                          alt="Fortress Console Access Mgr Tests"/>
                <br/>Test RBAC runtime functions like createSession and checkAccess.
            </li>
            <br/>
            <li>etc</li>
        </ul>
    </li>

</ol>
</body>
<p style="font: monospace; color: black; font-size: 6pt">Copyright 2003-2018, The Apache Software Foundation. All Rights
    Reserved.</p>
</html>
